<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Post</title>
    <style>
        #result {
            height: 150px;
            width: 200px;
            border: solid 1px #0c0ea8;  
        }
    </style>
</head>
<body>
    <div id="result"></div>
</body>
<script>
    let result = document.getElementById("result");
    result.addEventListener("mousemove", () => {
        let xhr = new XMLHttpRequest();
        xhr.open("POST", "http://127.0.0.1:8888/server");

        // 设置请求头
        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")

        xhr.send("a=100&b=200");
        xhr.onreadystatechange = () => {
            if(xhr.readyState == 4){
                if(xhr.status == 200 && xhr.status <= 300){
                    result.innerHTML = xhr.response;
                }
            }
        }
    })
</script>
</html>